package org.cfk.delaytasktutorial.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum LazyJobLazyLevel {
    MINUTE5(5, "5分钟", 10),
    MINUTE10(10, "10分钟", 20),
    MINUTE20(20, "20分钟", 30),
    MINUTE30(30, "30分钟", 60),
    MINUTE60(60, "60分钟", 120),
    MINUTE120(120, "120分钟", -1);

    private final Integer code;
    private final String text;
    private final Integer nextLevel;

    public static LazyJobLazyLevel fromCode(Integer code) {
        for (LazyJobLazyLevel level : values()) {
            if (level.getCode().equals(code)) {
                return level;
            }
        }
        return null;
    }
}